package com.cleaningcloud.cld.controller.mini;

import com.cleaningcloud.cld.domain.dto.CldAssetsRecordDto;
import com.cleaningcloud.cld.domain.dto.CldMaterialAppDto;
import com.cleaningcloud.cld.domain.vo.CldAssetsRecordVo;
import com.cleaningcloud.cld.domain.vo.CldAssetsRepairVo;
import com.cleaningcloud.cld.domain.vo.CldMaterialAppVo;
import com.cleaningcloud.cld.service.ICldMaterialAppService;
import com.cleaningcloud.cld.service.mini.IMiniAssetsService;
import com.cleaningcloud.common.core.web.controller.BaseController;
import com.cleaningcloud.common.core.web.domain.AjaxResult;
import com.cleaningcloud.common.core.web.page.TableDataInfo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * packageName com.cleaningcloud.cld.controller.mini
 *
 * @author Shaw
 * @version JDK 8
 * @className MiniAssetsController
 * @date 2025-06-06
 * @description 设备管理 - 小程序接口
 */
@RestController
@RequestMapping("/mini/assets")
public class MiniAssetsController extends BaseController {

    @Autowired
    private IMiniAssetsService iMiniAssetsService;

    /**
     * @Author Shaw
     * @Description 获取资产维修记录信息列表
     * @date: 2025-06-06 13:58
     * @param: //TODO
     */
    @Operation(description = "资产维修记录")
    @GetMapping("/getAssetsRecordList")
    public TableDataInfo getAssetsRecordList(CldAssetsRecordDto cldAssetsRecordDto) {
        startPage();
        List<CldAssetsRecordVo> list = iMiniAssetsService.getAssetsRecordList(cldAssetsRecordDto);
        return getMiniDataTable(list);
    }

    /**
     * @Author Shaw
     * @Description 获取资产维修记录信息详情
     * @date: 2025-06-06 13:58
     * @param: //TODO
     */
    @Operation(description = "资产维修记录详情")
    @GetMapping("/getAssetsRecordInfo")
    public AjaxResult getAssetsRecordInfo(CldAssetsRecordDto cldAssetsRecordDto) {
        return success(iMiniAssetsService.getAssetsRecordInfo(cldAssetsRecordDto));
    }

    /**
     * @Author Shaw
     * @Description 获取资产维修配件列表
     * @date: 2025-06-06 13:58
     * @param: //TODO
     */
    @Operation(description = "资产维修配件列表")
    @GetMapping("/getRepairListByAssetsRecordId")
    public TableDataInfo getRepairListByAssetsRecordId(Long assetsRecordId) {
        List<CldAssetsRepairVo> list = iMiniAssetsService.getRepairListByAssetsRecordId(assetsRecordId);
        return getMiniDataTable(list);
    }
}